package com.ytc.restcontroller;

import com.ytc.mapper.CommentMapper;
import com.ytc.model.Comment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 详细介绍类情况.
 *
 * @ClassName CommentServiceImpl
 * @Author zk
 * @Date 2023/1/14
 * @Version 1.0
 */
@RestController
public class CommentServiceImpl {

    @Autowired
    private CommentMapper commentMapper;

    //张阔：新增书评
    @RequestMapping("addComment")
    public void addComment(@RequestBody Comment comment){
        commentMapper.addComment(comment);
    }

    //张阔：查询书评
    @RequestMapping("queryCommentByBidAndUid")
    public Comment queryCommentByBidAndUid(@RequestParam("bid") Integer bid, @RequestParam("uid") Integer uid){
        return commentMapper.queryCommentByBidAndUid(bid,uid);
    }
}
